﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Windows.Forms;

namespace Pixysoft.Tools
{
    public class ScreenShot
    {
        public static Bitmap Capture(Point SourcePoint, Point DestinationPoint,
            Rectangle SelectionRectangle)
        {
            Bitmap bitmap = new Bitmap(SelectionRectangle.Width, SelectionRectangle.Height);

            using (Graphics g = Graphics.FromImage(bitmap))
            {
                g.CopyFromScreen(SourcePoint, DestinationPoint, SelectionRectangle.Size, CopyPixelOperation.SourceCopy);
            }

            return bitmap;
        }

        public static Bitmap Capture()
        {
            //http://www.daniweb.com/forums/thread115519.html#

            Rectangle rect = Screen.PrimaryScreen.WorkingArea;

            return Capture(new Point(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y), Point.Empty, rect);//0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);

        }
    }
}
